	<div class="tableData">
      <table>
        <thead>
          <tr>
            <th class="arrow-space"></th>
            <th align=left>Date</th>
            <th align=left>Description</th>
            <th>Amount</th>
            <th align=left>Division</th>
            <th align=left>Department</th>
            <th>Category</th>
            <th>Balance</th>
			<th></th>
          </tr>
        </thead>
        
	<?php 
	$running_total = 0;

	//foreach( $ledgers  as $ledger):		
	foreach( array_reverse($ledgers)  as $ledger): ?>
	
	<tr>
		<td class="arrow-space"></th>
		<td><?php echo $ledger['Ledger']['entry_date']; ?></td>
		<td><?php echo $ledger['Ledger']['details']; ?></td>
		<td class="<?php
		if ( $ledger['Ledger']['type'] == 'D') {
			echo "color_red";
		}
		?>"><?php 
		
		echo $this->Number->format($ledger['Ledger']['amount'], array(
			'places' => 2,
			'before' => '<font style="float:left">Rp </font>',
			'escape' => false,
			'decimals' => '.',
			'thousands' => ','
			));

		
		?></td>
		<td><?php echo $ledger['Division']['name']; ?></td>
		<td><?php echo $ledger['Department']['name']; ?></td>
		<td><?php echo $ledger['Category']['name']; ?></td>
		<td><?php 
				echo $this->Number->format($ledger['Ledger']['balance'], array(
					'places' => 2,
					'before' => 'Rp ',
					'escape' => false,
					'decimals' => '.',
					'thousands' => ','
					));				
		?></td>
		<td><?php
				echo $this->Html->link("<i class='icon-pen-note'></i>", 
										array(
											'controller' => 'ledgers', 
											'action' => 'edit',
											$ledger['Ledger']['id']
											),
										array(
											'class' => 'btn formToggle', 
											'title' => 'Edit Data',
											'escape' => FALSE
											)
										);
				echo "&nbsp;";
				echo $this->Html->link("<i class='icon-x'></i>", 
										array(
											'controller' => 'ledgers', 
											'action' => 'delete',
											$ledger['Ledger']['id']
											),
										array(
											'class' => 'btn', 
											'title' => 'Delete',
											'escape' => FALSE
											)
										);
		?>
		</td>
	</tr>		
	<?php endforeach ?>
    
    </table>
</div>
<?php
	$this->set('title_for_layout','Ledger Listing');
?>